package com.example.controller;

import cn.dev33.satoken.annotation.SaCheckRole;
import cn.dev33.satoken.annotation.SaMode;
import cn.dev33.satoken.util.SaResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/repo4")
public class RepoController4 {

    @PostMapping("/read")
    @SaCheckRole(value = {"管理员", "开发者", "访客"}, mode = SaMode.OR)
    public SaResult readRepo() {
        return SaResult.ok("可读仓库");
    }

    @PostMapping("/write")
    @SaCheckRole(value = {"管理员", "开发者"}, mode = SaMode.OR)
    public SaResult writeRepo() {
        return SaResult.ok("可写仓库");
    }

    @PostMapping("/delete")
    @SaCheckRole({"管理员"})
    public SaResult deleteRepo() {
        return SaResult.ok("可删除仓库");
    }
}
